// The function will be called in these situations
// 	1.The class has leave the scope.
// 	2.When you use "delete" to distory the class.


#include <iostream>
using namespace std;

class Human {
	public:
		Human( int n_age=0, const char* n_name="wuming" ): age(n_age), name(n_name) {
			cout << "This function has been called" << endl;
		}
		Human( const Human& that ):age(that.age), name(that.name) {
			cout << "called" << endl;
		}
		~Human( ) {
			cout << "The Human's function of destructor han benn called." << endl;
		}
		void getinfo( ) {
			cout << "name : " << name << endl;
			cout << "age : " << age << endl;
		}
	private:
		int age;
		string name;
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) { 
	Human h( 22, "zhangei" );
	Human h3(h);
	
	Human h4;
	h4 = h3;	// h4.operator = (h3)
	h4.getinfo( );

	return 0;
}	// 1.h.~Human( )	h3.~Human( ) 		h4.~Human( )
	// 2.Destory all the temporary variables

